<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<meta name="decorator" content="moduleList" />
<script
	src="${staticPath}/lib/datetimepicker/0.0.11/js/bootstrap-datetimepicker.min.js"
	type="text/javascript"></script>
<script
	src="${staticPath}/lib/datetimepicker/0.0.11/js/locales/bootstrap-datetimepicker.zh-CN.js"
	type="text/javascript"></script>
<script src="${staticPath}/lib/accounting/0.3.2/accounting.min.js"
	type="text/javascript"></script>
<script type="text/javascript">
	$(document).ready(
			function() {
				$(".o-a-form-date").datetimepicker({
					language : 'zh-CN',
					autoclose : true,
					minView : 2,
					todayBtn : 1,
					pickerPosition : "bottom-left"
				});
				$('[data-accounting]').each(
						function() {
							var $this = $(this);
							if ($this.attr("data-accounting-precision")
									&& "" != $this.attr("data-accounting-precision")) {
								$this.html(accounting.formatMoney($this
										.attr("data-accounting"), "¥ ", $this
										.attr("data-accounting-precision") * 1));
							} else {
								$this.html(accounting.formatMoney($this
										.attr("data-accounting"), "¥ "));
							}
						});

				$('#btnSelect').click(
						function() {
							window.open(
									'${contextPath}/statement/stm/prepaid/getByPrepaid?'
											+ $('#prepaidForm').serialize(),
									'_self');
						});
			});
</script>

</head>
<body>
<form:form name="listForm" modelAttribute="bizStatementStmPrepaid" method="post" class="form-inline" role="form">
	    <input type="hidden" name="deleteIds" >
		<ol class="breadcrumb map_1">
			<li><a href="${contextPath}/index">首页</a></li>
			<li><a href="${contextPath}/statement/stm/prepaid/list?navId=${navId}">结算对账</a></li>
			<li class="active">自营结算对账单</li>
		</ol>
		<div class="o-l-search-builder f_1">
	         <div id="statement-search-builder" class="collapse" style="height:auto;">
	             <div class="f_2">
	                 <div class="form-group col-sm-6">
	                      <label for="inputEmail3" class="col-sm-3 control-label f_4">开始日期：</label>
	                      <div class="col-sm-9 f_6">
	                        <div class="input-group date o-a-form-date" data-date="" data-date-format="yyyy-mm-dd">
	                            <input class="form-control f_13" name="startTime" value="<fmt:formatDate value="${stmPrepaid.startTime}" pattern="yyyy-MM-dd"/>" type="text" readonly/>
	                            <span class="input-group-addon f_time"><i class="glyphicon glyphicon-remove"></i></span>
	                            <span class="input-group-addon f_time"><span class="glyphicon glyphicon-calendar"></span></span>
	                        </div>
	                      </div>
	                  </div>
	                 <div class="form-group col-sm-6">
	                      <label for="inputEmail3" class="col-sm-3 control-label f_4">结束日期：</label>
	                      <div class="col-sm-9 f_6">
	                        <div class="input-group date o-a-form-date" data-date="" data-date-format="yyyy-mm-dd">
	                            <input class="form-control f_13" name="endTime" value="<fmt:formatDate value="${stmPrepaid.endTime}" pattern="yyyy-MM-dd"/>" type="text" readonly/>
	                            <span class="input-group-addon f_time"><i class="glyphicon glyphicon-remove"></i></span>
	                            <span class="input-group-addon f_time"><span class="glyphicon glyphicon-calendar"></span></span>
	                        </div>
	                      </div>
	                  </div>
	             </div> 
	         </div>
	         <div class="f_8">
	              <div class="f_2">
	                  <div class="col-sm-8 f_6">
	                    <c:if test="${isSupplier==0}">
	                      <form:input id="billNo" path="billNo" class="f_5" placeholder="结算单号"/>
	                   </c:if>
	                   <c:if test="${isSupplier==1}">
	                      <form:input id="contractNumber" path="contractNumber" class="f_5" placeholder="合同号"/>
	                   </c:if>
	                  </div>
	                  <button type="submit" class="btn btn-warning btn_1">查&nbsp;询</button>
	             </div>
	         </div>
	         <div class="o-l-chevron-down"><a href="#" class="btn btn-default" data-toggle="collapse" data-target="#statement-search-builder" id="chevronDownBtn" role="button"><span id="glyphiconspan" class="glyphicon glyphicon-chevron-down"></span></a>
	         </div>
	     </div>
		<tags:message content="${message}"/>
		<div class="o-l-search-builder f_9">
			<table class="table table-striped table-hover o-l-table table-bordered" id="table1">
				<thead class="t_1">
					<tr>
					    <th style="width:10%">门店</th>
					    <th style="width:19%">招商编码</th>
					    <th style="width:8%">主品牌</th>
					    <th style="width:8%">主品类</th>
						<c:if test="${isSupplier==0}">
						    <th style="width:10%">结算单号</th>
							<th style="width:10%">供应商编号</th>
						    <th style="width:15%">供应商名称</th>
						</c:if>
						<c:if test="${isSupplier==1}">
						    <th style="width:10%">合同号</th>
							<th style="width:10%">结算起始时间</th>
						    <th style="width:15%">结算结束时间</th>
						</c:if>
						<!-- <th>结算起始时间</th>
						<th>结算结束时间</th> -->
						<th style="width:10%">付款状态</th>
						<th style="width:10%">结算状态</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${page.list}" var="stmPrepaid">
						<tr
							data-herf="${contextPath}/biz/statement/stm/prepaid/getPrepaidBillNo?billNo=${stmPrepaid.billNo}&id=${stmPrepaid.id}&companyCode=${stmPrepaid.companyCode}&year=${stmPrepaid.year}"
							data-target="_self">
							<td>${stmPrepaid.shopName}</td>
							<td>${stmPrepaid.counters}</td>
							<td>${stmPrepaid.mainBrand}</td>
							<td>${stmPrepaid.cateName}</td>
							<c:if test="${isSupplier==0}">
							  <td>${stmPrepaid.billNo}</td>
							  <td>${stmPrepaid.supplierNo}</td>
							  <td>${stmPrepaid.supplierName}</td>
							</c:if>
							<c:if test="${isSupplier==1}">
							 <td>${stmPrepaid.contractNumber}</td>
							 <td><fmt:formatDate value="${stmPrepaid.startTime}"
									pattern="yyyy-MM-dd " /></td>
							<td><fmt:formatDate value="${stmPrepaid.endTime}"
									pattern="yyyy-MM-dd " /></td>
							</c:if>
							<%-- <td><fmt:formatDate value="${stmPrepaid.startTime}"
									pattern="yyyy-MM-dd " /></td>
							<td><fmt:formatDate value="${stmPrepaid.endTime}"
									pattern="yyyy-MM-dd " /></td> --%>
							<td><ossp:value dictType="PAYMENT_STATUS" key="${stmPrepaid.paymentStatus}"></ossp:value></td>
							<td><ossp:value dictType="BILL_STATUS" key="${stmPrepaid.billStatus}"></ossp:value></td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
        </div>
		<pager:pager pageSize="${page.pageSize}" pageNo="${page.pageNo}" url="" total="${page.total}"/>
		<script type="text/javascript" src="${staticPath}/js/list.js"></script>
  </form:form>
</body>
</html>